<script type="text/javascript" src="./Public/js/jgsat.js"></script>
<!--<script type="text/javascript" src="../Public/upload/plupload/plupload.full.min.js"></script>-->



<script type="text/javascript">
	function sub_save(){
		$("#myform2").submit();
		}
</script>
 <!-- 共用头部1 -->
	 <div id="top">
		 <div class="head1 clear">
			 <div class="account sprite_icon" style="text-align:center; ">
                  <a href="index.php?g=Mobile&m=User&a=index" style=" color:#FFF; line-height:50px">
                 {if cookie('username')}
                  {php $user=M('User')->field('username')->where('id='.$jgsatuserid)->find()}
                  {php echo $user['username']} 
                 {else}登录
                 {/if}
                 </a>
			 </div>
			 {if $title}
			    <div class="title">{$title}</div> 
               {else}
                <div class="title">{$seo_title}</div> 
               {/if}<div class="search sprite_icon" onclick="sub_save()">
			     <span class="keep" >保存</span>
			 </div>
		 </div>
	 </div>	
<include file="Mobile:nav"/> 
	 <div class="data Padding clear P_color">
		 <div class="pic demo">
			<a class="sty" onclick="clp()"  class="btn" id="btn">
				 <img src="{$vo.avatar}" id="head_photo_src" alt="" />
				  <p>编辑头像</p>
             </a><input type="file" name="head_photo" id="head_photo" value="" style="display:none">  
                  <input  type="hidden" name="photo_pic" id="photo_pic" value="">
		  <ul id="ul_pics" class="ul_pics clearfix"></ul>
		 </div>

		 <div class="info">
			 <div>
				 <strong>绑定邮箱：</strong>
				 <em>{if $vo[email]}{$vo[email]} {else} 未设置{/if}</em> 
				
			  {if $vo[email]}<a style="color:#F00;float: right;"  href="/index.php?g=Mobile&m=User&a=mobile_email"> 解绑</a>{else} <a style="color:#F00;float:right;"  href="/index.php?g=Mobile&m=User&a=mobile_email">立即设置</a>{/if}
             </div>
			<!-- <div>
				 <strong>绑定手机：</strong>
				 <em>178***89</em>
				 <a href="javascript:;">换绑</a>
			 </div>-->
			 <div>
				 <strong>登录密码：</strong>
				 <em>*******</em> 
				 <a href="index.php?g=Mobile&m=Register&a=edit">修改密码</a>
			 </div>
		 </div>
	 </div>
 <form method='post' id="myform2"  action="{:URL('Mobile-User/designer')}" >
 <input type="hidden" name="id" value="{$vo.id}" />

	 <div class="P_text p_topBorder Padding">
		 <strong>身份类型：</strong><span>设计师</span>
	 </div>
	 <div class="P_text Padding">
		 <strong>真实姓名：</strong><input type="text" disabled="disabled" name="realname" id="name1" size="12" value="{$vo[realname]}" />
	 </div>
	 <div class="P_text Padding">
		 <strong>毕业院校：</strong><input type="text" name="school" id="name2" size="12" value="{$vo[school]}" />
	 </div>
	 <div class="P_text Padding clear">
		 <strong>设计经验：</strong><span>
                <select name="experience"  id="name3" validate=" required:true">
                   <option value="">请选择</option>
                            <?php  $_result=M("Type")->field("*")->where("keyid=25 and typeid!=25")->order('listorder asc')->select(); foreach($_result as $key=>$r):?>
                                 <?php $seled = $vo[experience]==$r['typeid'] ? 'selected="selected"' : ' ';?>
                    <option value="{$r['typeid']}" {$seled}>{$r['name']}</option>
                            <?php endforeach;?>
                </select>
          </span>
	 </div>
	 <div class="P_text Padding">
		 <strong>所在地区：</strong><span>
            <select name="province" id="province" validate=" required:true" onchange="area_change(this.value, 1,'province','city','area');" class="selt mr5" >
            	<option value="0">省份</option>
            </select>
            <select name="city"  id="city" validate=" required:true" onchange="area_change(this.value, 2,'province','city','area');" id="city" class="selt mr5" >
                <option value="0">城市</option>
            </select>
           
            <script>area_change(0, 0,'province','city','area',{if $vo[province]!=0}{$vo[province]}{else}0{/if},{if $vo[city]!=0}{$vo[city]}{else}0{/if},{if $vo[area]!=0}{$vo[area]}{else}0{/if});
			</script>
         
         </span>
	 </div>
	 <div class="P_text Padding">
		 <strong>收费标准：</strong><span>
               <select name="charge" id="name6" validate=" required:true">
                      <option value="">请选择</option>
                          <?php  $_result=M("Type")->field("*")->where("keyid=34 and typeid!=34")->order('listorder asc')->select(); foreach($_result as $key=>$r):?>
                            <?php $seled = $vo[charge]==$r['typeid'] ? 'selected="selected"' : ' ';?>
                      <option value="{$r['typeid']}" {$seled}>{$r['name']}</option>
                           <?php endforeach;?>
                </select>
         
         </span>
	 </div>
	 <div class="P_text Padding">
		 <strong>QQ：</strong><span><input name="qq" type="text" id="name7"  value="{$vo[qq]}" /> </span>
	 </div>
	 <div class="P_text Padding">
		 <span class="txspan">荣誉资质：</span><textarea class="wind_textar1"  name="reward" id="name8">{$vo[reward]}</textarea>
	 </div>
	 <div class="P_text Padding">
		 <strong>擅长空间：</strong><span>
         <?php $itemType=explode(",",$vo['itemType']); ?>
            <YP:list name="Label" where="genre=17" id="r" limit="50">
               <?php $seled = in_array($r['id'],$itemType) ? 'checked="checked"' : '';?>
                <li>
                  <input name="itemType[]" type="checkbox"  validate=" required:true" {$seled} class="choice" value="{$r['id']}">{$r['title']}
                </li>
            </YP:list>
         
         
         </span>
	 </div>
	 <div class="P_text Padding">
		 <span class="txspan">自我介绍：</span><textarea style="font-family:微软雅黑" name="my_introduce" class="wind_textar1"  id="name10">{$vo[my_introduce]}</textarea> 
	 </div>
           <input type="hidden" id="avatar" name="avatar"  value="{$vo.avatar}"/>
           <input type="hidden" id="pic" name="pic"  value="{$vo.pic}"/>
   </form>
   
   <script>
      /* var uploader = new plupload.Uploader({ //创建实例的构造方法
                runtimes: 'html5,flash,silverlight,html4', //上传插件初始化选用那种方式的优先级顺序
                browse_button: 'btn', // 上传按钮
                url: "index.php?g=Mobile&m=Upload&a=index", //远程上传地址
                flash_swf_url: '../Public/upload/plupload/Moxie.swf', //flash文件地址
                silverlight_xap_url: '../Public/upload/plupload/Moxie.xap', //silverlight文件地址
                filters: {
                    max_file_size: '10mb', //最大上传文件大小（格式100b, 10kb, 10mb, 1gb）
                    mime_types: [//允许文件上传类型
                        {title: "files", extensions: "jpg,png,gif"}
                    ]
                },
                multi_selection: false, //true:ctrl多文件上传, false 单文件上传
                init: {
                    FilesAdded: function(up, files) { //文件上传前
                        if ($("#ul_pic").children("li").length > 30) {
                            alert("您上传的图片太多了！");
                            uploader.destroy();
                        } else {
                            var li = '';
                            plupload.each(files, function(file) { //遍历文件
                                li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div></li>";
                            });
                            $("#ul_pic").append(li);
                            uploader.start();
                        }
                    },
                    UploadProgress: function(up, file) { //上传中，显示进度条
                 var percent = file.percent;
                        $("#" + file.id).find('.bar').css({"width": percent + "%"});
                        $("#" + file.id).find(".percent").text(percent + "%");
                    },
                    FileUploaded: function(up, file, info) { //文件上传成功的时候触发
					
                       var data = eval("(" + info.response + ")");
					  // alert(data.name)
                        //$("#" + file.id).html("<div class='img'><img src='" + data.pic + "'/></div><p>" + data.name + "</p>");
						document.getElementById("t_a").src=data.pic;
						$("#avatar").val(data.pic);
                    },
                    Error: function(up, err) { //上传出错的时候触发
					if(err.message=='File size error.'){
						err.message='图片大小超过限制';
						};
                        alert(err.message);
                    }
                }
            });
			 uploader.init();*/
  
   
   </script>
<script type="text/javascript" src="./Public/avarat/js/ajaxfileupload.js"></script>
<script type="text/javascript" src="./Public/avarat/js/artDialog4.1.6/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="./Public/avarat/js/artDialog4.1.6/plugins/iframeTools.js"></script>
<script>
 function clp(){
   return  $("#head_photo").click();
 }
$(document).ready(function(e){
		
	$('#head_photo').live('change',function(){ 
		ajaxFileUploadview('head_photo','photo_pic',"index.php?g=Mobile&m=Upload&a=avarat");
	});	

});


function show_head(head_file){
	
	//插入数据库
	//$.post("{:U('Home/Index/update_head')}",{head_file:head_file},function(result){		
		$("#head_photo_src").attr('src',head_file);
		$("#avatar").val(head_file);		
	//});	

}

//文件上传带预览
function ajaxFileUploadview(imgid,hiddenid,url){
		
		
		$.ajaxFileUpload
		({
			url:url,
			secureuri:false,
			fileElementId:imgid,
			dataType: 'json',
			data:{name:'logan', id:'id'},
			success: function (data, status)
			{
				if(typeof(data.error) != 'undefined')
				{
					if(data.error != '')
					{
						var dialog = art.dialog({title:false,fixed: true,padding:0});
						dialog.time(2).content("<div class='tips'>"+data.error+"</div>");
					}else{

						var resp = data.msg;						
						if(resp != '0000'){
							var dialog = art.dialog({title:false,fixed: true,padding:0});
							dialog.time(2).content("<div class='tips'>"+data.error+"</div>");
							return false;
						}else{
							$('#'+hiddenid).val(data.imgurl);						

							art.dialog.open("index.php?g=Mobile&m=Upload&a=avarat_img&img="+data.imgurl,{
								title: '裁剪头像',
								width:'90%',
								height:'100%'
							});						
							
							//dialog.time(3).content("<div class='msg-all-succeed'>上传成功！</div>");
						}
									

						
						
					}
				}
			},
			error: function (data, status, e)
			{
alert(1)
				dialog.time(3).content("<div class='tips'>"+e+"</div>");
			}
		})

		return false;
	}

</script>
